cc.Class({
    extends: cc.Component,

    properties: {
        
    },
    onLoad () {
        cc.log("[Ball]ball onLoad");
    },

    start () {
        cc.log("[Ball]ball start");
        // this.node.position = cc.v2(0,0);//初始化位置
        // this.getComponent(cc.RigidBody).linearVelocity = cc.v2(10,10);//初始化速度
        this.rigidBody = this.getComponent(cc.RigidBody);
        cc.log("[Ball]position="+this.node.position);
        cc.log("[Ball]enabledContactListener="+this.rigidBody.enabledContactListener);
        cc.log("[Ball]angularDamping="+this.rigidBody.angularDamping);
        cc.log("[Ball]angularVelocity="+this.rigidBody.angularVelocity);
        cc.log("[Ball]linearVelocity="+this.rigidBody.linearVelocity);
         
    },

    // onBeginContact(contact, self, other) {
    //     switch (other.tag) {
    //         case 1://球碰到砖块
    //             //this.gameCtl.onBallContactBrick(self.node, other.node);
    //             break;
    //         case 2://球碰到地面
    //            // this.gameCtl.onBallContactGround(self.node, other.node);
    //             break;
    //         case 3://球碰到托盘
    //            // this.gameCtl.onBallContactPaddle(self.node, other.node);
    //             break;
    //         case 4://球碰到墙
    //           //  this.gameCtl.onBallContactWall(self.node, other.node);
    //             break;
    //     }
    // },

    //    // 只在两个碰撞体结束接触时被调用一次
    //    onEndContact: function (contact, selfCollider, otherCollider) {
    //     cc.log("[Ball] collison ball end");
    //     if (otherCollider.tag == 99) {
    //         let rigidBody2 = selfCollider.getComponent(cc.RigidBody);
    //         // 获取移动速度
    //         // cc.log("[Ball]linearVelocity="+rigidbody2.linearVelocity);
    //         // var velocity = rigidbody.linearVelocity*2;//初始化速度;
    //         // // 设置移动速度
    //         // rigidbody.linearVelocity = velocity;
    //         // cc.log("[Ball]linearVelocity2="+rigidbody.linearVelocity);
    //     }
    // },
});